package com.joolun.weixin.service.impl;

import java.util.List;

import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import com.joolun.weixin.mapper.ScrmJobUserMapper;
import com.joolun.weixin.service.IScrmJobUserService;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;
import com.joolun.system.domain.ScrmJobUser;

/**
 * 教职人员Service业务层处理
 * 
 * @author jon
 * @date 2025-03-06
 */
@Service
public class ScrmJobUserServiceImpl extends  ServiceImpl<ScrmJobUserMapper, ScrmJobUser> implements IScrmJobUserService
{
    @Autowired
    private ScrmJobUserMapper scrmJobUserMapper;

    /**
     * 查询教职人员
     * 
     * @param id 教职人员主键
     * @return 教职人员
     */
    @Override
    public ScrmJobUser selectScrmJobUserById(Long id)
    {
        return scrmJobUserMapper.selectScrmJobUserById(id);
    }

    /**
     * 查询教职人员列表
     * 
     * @param scrmJobUser 教职人员
     * @return 教职人员
     */
    @Override
    public List<ScrmJobUser> selectScrmJobUserList(ScrmJobUser scrmJobUser)
    {
        // 添加主体id
        scrmJobUser.setCorpId(TenantContext.getTenantId());
        return scrmJobUserMapper.selectScrmJobUserList(scrmJobUser);
    }
    /**
     * 验证兜底是否只有一个
     *
     * @param scrmJobUser 教职人员
     * @return 教职人员
     */
    @Override
    public List<ScrmJobUser> selectIsJobUserList(ScrmJobUser scrmJobUser)
    {
        // 添加主体id
        scrmJobUser.setCorpId(TenantContext.getTenantId());
        return scrmJobUserMapper.selectIsJobUserList(scrmJobUser);
    }
    /**
     * 新增教职人员
     * 
     * @param scrmJobUser 教职人员
     * @return 结果
     */
    @Override
    public int insertScrmJobUser(ScrmJobUser scrmJobUser)
    {
        // 添加主体id
        scrmJobUser.setCorpId(TenantContext.getTenantId());
        scrmJobUser.setCreateTime(DateUtils.getNowDate());
        return scrmJobUserMapper.insertScrmJobUser(scrmJobUser);
    }

    /**
     * 修改教职人员
     * 
     * @param scrmJobUser 教职人员
     * @return 结果
     */
    @Override
    public int updateScrmJobUser(ScrmJobUser scrmJobUser)
    {
        scrmJobUser.setUpdateTime(DateUtils.getNowDate());
        return scrmJobUserMapper.updateScrmJobUser(scrmJobUser);
    }

    /**
     * 批量删除教职人员
     * 
     * @param ids 需要删除的教职人员主键
     * @return 结果
     */
    @Override
    public int deleteScrmJobUserByIds(Long[] ids)
    {
        return scrmJobUserMapper.deleteScrmJobUserByIds(ids);
    }

    /**
     * 删除教职人员信息
     * 
     * @param id 教职人员主键
     * @return 结果
     */
    @Override
    public int deleteScrmJobUserById(Long id)
    {
        return scrmJobUserMapper.deleteScrmJobUserById(id);
    }
}
